package com.yanfan.parking.service.impl;

import java.util.Arrays;
import java.util.List;
import com.yanfan.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanfan.parking.mapper.NjOutParkingRecordMapper;
import com.yanfan.parking.domain.NjOutParkingRecord;
import com.yanfan.parking.service.INjOutParkingRecordService;

/**
 * 停车场出场记录Service业务层处理
 *
 * @author genluo
 * @date 2024-10-28
 */
@Service
public class NjOutParkingRecordServiceImpl extends ServiceImpl<NjOutParkingRecordMapper, NjOutParkingRecord> implements INjOutParkingRecordService {
    @Autowired
    private NjOutParkingRecordMapper njOutParkingRecordMapper;


    /**
     * 查询停车场出场记录列表
     *
     * @param njOutParkingRecord 停车场出场记录
     * @return 停车场出场记录
     */
    @Override
    public List<NjOutParkingRecord> queryPageList(NjOutParkingRecord njOutParkingRecord) {
        LambdaQueryWrapper<NjOutParkingRecord> lqw = buildQueryWrapper(njOutParkingRecord);
        return njOutParkingRecordMapper.selectList(lqw);
        //连表查询可用该方法，在此方法SQL语句上进行扩展
        //return njOutParkingRecordMapper.queryPageList(njOutParkingRecord);
    }

    /**
    * 分页查询条件
    * @return
    */
    private LambdaQueryWrapper<NjOutParkingRecord> buildQueryWrapper(NjOutParkingRecord bo) {
        LambdaQueryWrapper<NjOutParkingRecord> lqw = Wrappers.lambdaQuery();
        lqw.eq(StringUtils.isNotBlank(bo.getActTime()), NjOutParkingRecord::getActTime, bo.getActTime());
        lqw.eq(StringUtils.isNotBlank(bo.getActType()), NjOutParkingRecord::getActType, bo.getActType());
        lqw.eq(StringUtils.isNotBlank(bo.getAddBerth()), NjOutParkingRecord::getAddBerth, bo.getAddBerth());
        lqw.eq(StringUtils.isNotBlank(bo.getArriveTime()), NjOutParkingRecord::getArriveTime, bo.getArriveTime());
        lqw.eq(StringUtils.isNotBlank(bo.getBerthId()), NjOutParkingRecord::getBerthId, bo.getBerthId());
        lqw.eq(StringUtils.isNotBlank(bo.getBusinessType()), NjOutParkingRecord::getBusinessType, bo.getBusinessType());
        lqw.eq(StringUtils.isNotBlank(bo.getCarNum()), NjOutParkingRecord::getCarNum, bo.getCarNum());
        lqw.eq(StringUtils.isNotBlank(bo.getCarNumColor()), NjOutParkingRecord::getCarNumColor, bo.getCarNumColor());
        lqw.eq(StringUtils.isNotBlank(bo.getCarType()), NjOutParkingRecord::getCarType, bo.getCarType());
        lqw.eq(bo.getGuestRemainNum() != null, NjOutParkingRecord::getGuestRemainNum, bo.getGuestRemainNum());
        lqw.eq(StringUtils.isNotBlank(bo.getIsOfflinePay()), NjOutParkingRecord::getIsOfflinePay, bo.getIsOfflinePay());
        lqw.eq(StringUtils.isNotBlank(bo.getLeaveTime()), NjOutParkingRecord::getLeaveTime, bo.getLeaveTime());
        lqw.eq(bo.getMonthlyRemainNum() != null, NjOutParkingRecord::getMonthlyRemainNum, bo.getMonthlyRemainNum());
        lqw.eq(StringUtils.isNotBlank(bo.getOrderNo()), NjOutParkingRecord::getOrderNo, bo.getOrderNo());
        lqw.eq(StringUtils.isNotBlank(bo.getParkingCarColor()), NjOutParkingRecord::getParkingCarColor, bo.getParkingCarColor());
        lqw.eq(StringUtils.isNotBlank(bo.getParkingCarLogo()), NjOutParkingRecord::getParkingCarLogo, bo.getParkingCarLogo());
        lqw.eq(StringUtils.isNotBlank(bo.getParkingCarType()), NjOutParkingRecord::getParkingCarType, bo.getParkingCarType());
        lqw.eq(StringUtils.isNotBlank(bo.getParkingLot()), NjOutParkingRecord::getParkingLot, bo.getParkingLot());
        lqw.eq(bo.getParkingTimeLength() != null, NjOutParkingRecord::getParkingTimeLength, bo.getParkingTimeLength());
        lqw.eq(bo.getPayMoney() != null, NjOutParkingRecord::getPayMoney, bo.getPayMoney());
        lqw.eq(StringUtils.isNotBlank(bo.getPaymentType()), NjOutParkingRecord::getPaymentType, bo.getPaymentType());
        lqw.eq(StringUtils.isNotBlank(bo.getSluiceDevChnId()), NjOutParkingRecord::getSluiceDevChnId, bo.getSluiceDevChnId());
        lqw.like(StringUtils.isNotBlank(bo.getSluiceDevChnName()), NjOutParkingRecord::getSluiceDevChnName, bo.getSluiceDevChnName());
        lqw.eq(bo.getTotRemainNum() != null, NjOutParkingRecord::getTotRemainNum, bo.getTotRemainNum());
        lqw.eq(StringUtils.isNotBlank(bo.getVoucherNo()), NjOutParkingRecord::getVoucherNo, bo.getVoucherNo());
        lqw.eq(StringUtils.isNotBlank(bo.getVoucherType()), NjOutParkingRecord::getVoucherType, bo.getVoucherType());
        lqw.orderByDesc(NjOutParkingRecord :: getActTime);
        return lqw;
    }



}
